package com.creed.energy.project.system.common.model;

/**
 * @author btmood
 * @version 1.0
 * @apiNote 返回值生成器
 * @since 2023-11-19 22:00
 */
public class ResultGenerator {
    public static <T> Result<T> genSuccessResult() {
        return new Result<>(ResultCode.SUCCESS);
    }

    public static <T> Result<T> genSuccessResult(T data) {
        return new Result<T>(ResultCode.SUCCESS).setData(data);
    }

    public static <T> Result<T> genFailResult() {
        return new Result<>(ResultCode.FAIL);
    }

    public static <T> Result<T> genFailResult(String message) {
        return new Result<T>(ResultCode.FAIL).setMessage(message);
    }
}
